#include <stdio.h>
#include "calc.h"

#define MAXVAl 100

int sp = 0;
double val[MAXVAl];

void push(double f)
{
    if (sp < MAXVAl)
    {
        val[sp++] = f;
    }
    else
    {
        printf("error: stack full, can not push %g\n", f);
	}
}

double pop(void)
{
    if (sp > 0)
    {
        return val[--sp];
    }
    else
    {
        printf("error: stack empty\n");
        return 0.0;
	}
}
